package com.wolfheader.wolfgame.controller.admin;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.wolfheader.wolfgame.service.admin.AdminService;

@Controller("adminHomePageController")
@RequestMapping("/admin")
public class HomePageController {

	private static final String template_url = "admin";

	@Resource(name = "adminServiceImpl")
	private AdminService adminService;

	@RequestMapping(method = RequestMethod.GET)
	public String home(HttpServletRequest request, ModelMap map) {
		map.addAttribute("currentAdmin", adminService.getCurrent());
		map.addAttribute("menu1", "admin");
		map.addAttribute("menu2", "list");
		return template_url + "/index";
	}
	
	@RequestMapping(value="/index", method = RequestMethod.GET)
	public String index(HttpServletRequest request, ModelMap map) {
		
		return "redirect:/admin";
	}
}
